#! /bin/bash
# Welcome / first login screen for Debian Cinnamon Remaster ISO (name change imminent)
# boilerplate for goto taken from https://bobcopeland.com/blog/2012/10/goto-in-bash/
function jumpto
{
    label=$1
    cmd=$(sed -n "/$label:/{:a;n;p;ba};" $0 | grep -v ':$')
    eval "$cmd"
    exit
}

start=${1:-"start"}

jumpto $start


start:
if [ ! -e ~/.config/nodelogistics/firstrundone ]; then
#firstrunsetup
gsettings set org.gnome.desktop.background picture-uri 'file:///opt/debian-remaster-iso-files/Icetwigs.png'

gsettings set org.cinnamon.desktop.wm.preferences theme 'Menta'

gsettings set org.nemo.desktop computer-icon-visible true
gsettings set org.nemo.desktop trash-icon-visible true
gsettings set org.nemo.desktop home-icon-visible true
gsettings set org.nemo.desktop network-icon-visible true
touch ~/.config/nodelogistics/firstrundone
fi
if [ -e ~/.config/nodelogistics/donotdisturb ]; then
	if [ $1 = 'autostarted' ]; then
	exit 0
	fi
fi

startdialg=$(zenity --list --column Action --height 720 --column Description --title 'Welcome' --text 'Welcome to your new operating system! Here are a few first steps to set up your new desktop.' Dark 'Switch to dark mode (Adwaita)' Light 'Switch to light mode (Adwaita)' ___ ___ Software 'Install new software using the software centre' HP 'Install HP Linux Printing and Imaging System' Chrome 'Install Google Chrome' Brave 'Install Brave Browser' Discord 'Install Discord Chat' VSCode 'Install Visual Studio Code (VSCodium)' 'WPS Office' 'Install WPS Office (it will be firewalled by default)' ___ ___ Help 'Opens the Debian user forums (http://forums.debian.net/)' Reddit 'r/Debian on Reddit' ___ ___ Contribute 'Opens the Debian page on contributing to the project' ___ ___ 'DND' 'Do not show this at login')

echo $startdialg

if [ $startdialg = '___' ]; then
echo 'lol'
jumpto start
elif [ $startdialg = 'Dark' ]; then
gsettings set org.cinnamon.desktop.interface gtk-theme 'Adwaita-dark'
elif [ $startdialg = 'Light' ]; then
gsettings set org.cinnamon.desktop.interface gtk-theme 'Adwaita'
elif [ $startdialg = 'Software' ]; then
gnome-software
elif [ $startdialg = 'HP' ]; then
zenity --info --title='Install HP Linuux Printing and Imaging System' --text='To install HP Linux Printing and Imaging System, please enter your password in the next screen, or press \"cancel\" to stop installing.'
pkexec gnome-terminal -- apt install -y hplip-gui
elif [ $startdialg = 'Chrome' ]; then
gnome-software --details=com.google.Chrome
elif [ $startdialg = 'Brave' ]; then
gnome-software --details=com.brave.Browser
elif [ $startdialg = 'Discord' ]; then
gnome-software --details=com.discordapp.Discord
elif [ $startdialg = 'VSCode' ]; then
gnome-software --details=com.vscodium.codium
elif [ $startdialg = 'WPS Office' ]; then
gnome-software --details=com.wps.Office
elif [ $startdialg = 'Help' ]; then
xdg-open https://forums.debian.net//
elif [ $startdialg = 'Reddit' ]; then
xdg-open https://www.reddit.com/r/debian/
elif [ $startdialg = 'Contribute' ]; then
xdg-open https://www.debian.org/intro/help
elif [ $startdialg = 'DND' ]; then
touch ~/.config/nodelogistics/donotdisturb
fi
